class Animal{
    private String name;
    private int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
interface Run{
    public abstract void run();
}
interface Swim{
    void swim();
}
interface Action extends Run,Swim{
//Action接口拓展了Run,Swim接口
    void action();
}
class Dog extends Animal implements Action{
    //既要重写Action中的方法，也要重写Run,Swim中的方法

    public Dog(String name, int age) {
        super(name, age);
    }
    @Override
    public void action() {
        System.out.println(this.getName()+"开始行动了");
    }
    @Override
    public void run() {
        System.out.println(this.getName()+"正在跑");
    }

    @Override
    public void swim() {
        System.out.println(this.getName()+"正在游泳");
    }


}
public class Test {
    public static void main(String[] args) {
        Dog dog=new Dog("旺财",2);
        dog.action();
        dog.run();
        dog.swim();
    }
}
